﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PT.Common.Tests {
    /// <summary> This is a test class for RationalTest and is intended
    ///to contain all RationalTest Unit Tests </summary>
    [TestClass]
    public class RationalTest {
        
        /// <summary> A test for Reduce </summary>
        [TestMethod]
        public void ReduceTest() {
            var a = new Rational( 4, 8 ); 
            var expected = new Rational( 1, 2 );

            var actual = Rational.Reduce( a );

            Assert.AreEqual( expected, actual );
        }

        /// <summary> A test for Add </summary>
        [TestMethod]
        public void AddTest() {
            var a = new Rational( 1, 2 ); 
            var b = new Rational( 1, 4 ); 
            var expected = new Rational( 3, 4 );

            var actual = Rational.Add( a, b );

            Assert.AreEqual( expected, actual );
        }

        /// <summary> A test for Multiply </summary>
        [TestMethod]
        public void MultiplyTest() {
            var a = new Rational( 9, 10 ); 
            var b = new Rational( 5, 8 ); 
            var expected = new Rational( 9, 16 );

            var actual = Rational.Multiply( a, b );

            Assert.AreEqual( expected, actual );
        }
        
    }
}
